# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rssh
pkgver=2.3.4
pkgrel=4
pkgdesc="Restricted shell for use with OpenSSH, allowing only scp, sftp, and/or rsync"
url="http://www.pizzashack.org/rssh/"
arch="all"
license="BSD-2-Clause"
depends="openssh"
makedepends="rsync"
install="$pkgname.post-install $pkgname.post-deinstall"
subpackages="$pkgname-doc"
source="https://prdownloads.sourceforge.net/rssh/rssh-$pkgver.tar.gz
	makefile.patch
	fix-error-message-for-invalid-option.patch
	handle-rsync-v3-e-option.patch
	verify-scp-options.patch
	check-command-line-after-chroot.patch"
options="suid !check"

# secfixes:
#   2.3.4-r2:
#     - CVE-2019-3463
#     - CVE-2019-1000018
#   2.3.4-r1:
#     - CVE-2019-3464

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libexecdir=/usr/lib/$pkgname \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
c1a77abdf4abe5f936fb1c9c008fc81fabf7b624d69ed31fe2ae5619dfa4a79f1d4a4f2daa5291a36d40353fa2168e74e5ba61294230d702fcdc88ae0d520487  rssh-2.3.4.tar.gz
7b1120b47a1c5d251f002d4196ffac66bcc4518b34284831932d7ef0aae839777c8188cb2addacb57241b6208c03c5b14f1845a50bb5b72461f80a7f943ef051  makefile.patch
abad4a707f7851c60549d6073c331a4a2b47bdcf97956d5cbad3af9bcb83d6ad33694ac3270df5c7df6ec709026e0253c49024fa20a33a453524547031df77aa  fix-error-message-for-invalid-option.patch
942dd8e0495cf13bbb679332cab6c1781560e32ade0905527fe71e5399f930edfe0c442653deb218a182b11e49599c3bd78d0fc715de45cf9aa078e6a586b9c7  handle-rsync-v3-e-option.patch
1be9e3be58e44359e51ad16e10fa3674bf322059131a93ed44487f0fefa89130806f7851d725e20eeff5af40f5b5558ca471ab5eba932a8ce654b25845a7328e  verify-scp-options.patch
d4d8518b109c6d2d99a8c9a3a49f4df1b29e621f9826e80c599aa2c991ca9c4b6fe683d2475da7935e375e5049a8c33e8dd9019e83ed2111804bba02e03c6f48  check-command-line-after-chroot.patch
"
